package org.client.iot.ui.project.adapter;

import android.content.Context;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.client.iot.R;
import org.client.iot.domain.MenuItem;

import java.util.List;

public class ProjectOptionAdapter extends BaseQuickAdapter<MenuItem, BaseViewHolder> {

    private Context mContext;

    public ProjectOptionAdapter(Context context, @Nullable List<MenuItem> data) {
        super(R.layout.content_adapter_project_option, data);
        this.mContext = context;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, MenuItem menuItem) {
        baseViewHolder.setText(R.id.textView_menu_title,menuItem.getMenuName());

        ImageView menuImage = (ImageView)baseViewHolder.getView(R.id.image_menu_icon);

        Glide.with(mContext).load(menuItem.getMenuResId())
                .into(menuImage);
    }
}
